Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct INT Flag 8 to set page table entries to the correct value rather than 1 #24

Merged

Conversation

DerelictDrone
Copy link
Member

@DerelictDrone DerelictDrone commented Nov 25, 2023

In the code for the interrupt handler, there is a small table of what the interrupt flags should do

      --Flags:
      --3  [8 ] = CMPR shows if interrupt occured
      --4  [16] = Interrupt does not set CS
      --5  [32] = Interrupt enabled
      --6  [64] = NMI interrupt
      --7  [128] = Replace PTBL with NewPTE (overrides #8)
      --8  [256] = Replace PTBE with NewPTE
      --9  [512] = Push extended registers (R0-R31)

This brings interrupt flag 8, (Replace page table entries with page table byte from interrupt descriptor) closer to what the comment implies it should do, due to a possible mistake in the original implementation in this commit and this second commit claiming to fix it, both from 11 years ago.

Since setting the page table and page table entries are intended to not be possible at the same time, setting page table entries to 1 seems to be a mistake even if it was claimed to be fixed, unless the intended usecase was for the programmer to then go and find the interrupt descriptor and set the number of page table entries themselves now that they're not being remapped?

The original author appears to have no github, somehow, so I can't contact them to ask if this was intended.

@thegrb93
Copy link
Contributor

So 7 and 8 do the same thing now?

@DerelictDrone
Copy link
Member Author

@thegrb93 Int 7 changes the pointer to the page table, Int 8 instead changes the number of entries that it will check

If you were to have a page table of say, 32 entries, and you put 16 as byte 3 to the interrupt descriptor of an interrupt with flag 8, it will stop checking the indexes past 16, so you can have your less important page mappings lower in the list, and have this interrupt basically "disable" them temporarily, without having to have a secondary copy of your page table that's half empty and setting your page table pointer to that.

Right now, it setting PTBE to 1 effectively makes it disable all but the first entry, which iirc holds the global/default run level settings, if the user wanted this behavior they could set byte 3 to 1 themselves.

@thegrb93
Copy link
Contributor

Ok, I'll trust your insight. the code change looks fine

@thegrb93 thegrb93 merged commit 82545eb into wiremod:master Nov 27, 2023
1 check failed
@DerelictDrone DerelictDrone deleted the fix-interrupt-handler-PTE-flag branch December 3, 2023 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants